<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="../common/taglibs.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="StyleSheet" type="text/css" href="<%=request.getContextPath()%>/pages/css/common.css"></link>
<title>DFASS</title>
<sx:head/>
</head>
<body>
	<div class="headerContent" align="center">
		<div class="header">
		<%@ include file="../inc/logged_top.jsp" %>			
		</div>
		<div id="nav_container">
		<%@ include file="../menu/menu_customer.jsp" %>
	    </div>
	</div>
	
	<div class="bodyContent" align="center">
		<table><tr><td>&nbsp;</td></tr></table>
		<s:form theme="simple">
			<!-- This Empty Table is Required before the content of the body -->
			<table class="tblAdminNormal">
				<thead>
					<tr>
						<td colspan="7" width="800px" >User Privileges</td>
					</tr>
				</thead>
			</table>		
			<table>
			    <tr>
			        <td>username</td>
			        <td>
                    	<sx:autocompleter name="u" list="users" autoComplete="true" 
                    		listKey="userId" listValue="username" 
                    		onkeyup="javascript:showUserEvents();return false;" 
                    		onchange="javascript:showUserEvents();return false;" /> 
   					</td>
   					<td><input type="button" value="Search"  onclick="cshowUserEvents();" /></td>
			    </tr>
			</table>	
  				<s:url id="pri_url" action="cshowUserEvents" />
	            <sx:div id="details" href="%{pri_url}" listenTopics="showUserEvents" 
                					                        formId="eventForm" ></sx:div>

		        	<c:forEach var="module" items="${modules}">
				        <tr>
							<td width="119">${module}</td>
				        </tr>
		        	</c:forEach>

 			<table class="userList">
				<thead>
					<tr height="30px">
			            <td width="119">Module name</td>
			            <td width="110">Function</td>
		            </tr>
		        </thead>
		        <tbody>
		        	<c:forEach var="module" items="${modules}">
				        <tr>
							<td width="119">${module}</td>
							<td width="119">
								<table>
						        	<c:forEach var="page" items="${pages}">
						        		<c:if test="${page.module == module }">
						        			<tr>
						        				<td >
						        					<s:checkbox value="false" fieldValue="page.pageID" label="%{page.pageID }"   theme="simple" name="selectedPages">${page.function}</s:checkbox>
						        				</td>
						        			</tr>
						        		</c:if>
						        	</c:forEach>
					        	</table>
							</td>
				        </tr>
		        	</c:forEach>
		        </tbody>
			</table>
		</s:form>
	</div>
	
	<div class="footerContent" align="center">
		<div class="footer">
			<%@ include file="/pages/inc/footer.jsp" %>
		</div>
	</div>
	
</body>
</html>